CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bridge_viewing  main.go

project_name=bridge_viewing
project_env=bridge_viewing_dev_server
project_host=gcompany.gentryhair.com

echo 'send server'
scp -P  30001 *.yml *.sh root@$project_host:/opt/deploy/$project_env/$project_name
scp -P  30001 $project_name root@$project_host:/opt/deploy/$project_env/$project_name/tmp_$project_name

echo 'backup server exe'
ssh -p 30001 root@$project_host "mv -f /opt/deploy/$project_env/$project_name/$project_name /opt/deploy/$project_env/$project_name/$project_name-bak"
ssh -p 30001 root@$project_host "mv -f /opt/deploy/$project_env/$project_name/tmp_$project_name /opt/deploy/$project_env/$project_name/$project_name"

echo 'start server'
ssh -p 20058 root@$project_host "export APP_ENV=dev && /opt/deploy/$project_env/$project_name/start.sh >> /opt/deploy/$project_env/$project_name/nohup.log"
